#include <stdio.h>
#include <stdlib.h>

//https://www.nowcoder.com/practice/7548f8f5e44c42fa84fb2323d899a966?tpId=290&tags=&title=&difficulty=0&judgeStatus=0&rp=0&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D290

typedef struct Flexible {
    int N;
    int Mat[0];
}Flexible;

int main() {
    int row = 0;
    int col = 0;
    scanf("%d%d", &row, &col);
    //创建柔性数组
    Flexible *arr = (Flexible *) malloc(sizeof(Flexible) + row * col * sizeof(int));
    if (arr == NULL) {
        perror("堆区开辟空间失败:");
    }
    arr->N = row * col;
    //柔性数组的使用
    for (int i = 0; i < arr->N; i++) {
        if (i % col == 0) {
            printf("\n");
        }
        scanf("%d", &arr->Mat[i]);
        printf("%d", arr->Mat[i]);
    }
    //释放柔性数组
    free(arr);
    arr = NULL;
    return 0;
}